/**
 * 区域数据转换
 * @param {*} area 
 * @returns 
 */
export function areaTransform(area) {
  // eslint-disable-next-line
  const point = area.match(/[^\(\)]+(?=\))/g)[0].split(", ");
  if (area.match("Circle")) {
    return {
      type: "Circle",
      center: point[0].split(" "),
      radius: Number(point[1]),
    };
  }
  if (area.match("Polygon")) {
    const path = [];
    point.forEach((item) => {
      path.push(item.split(" "));
    });
    return {
      type: "Polygon",
      path: path,
    };
  }
  if (area.match("LineString")) {
    const path = [];
    point.forEach((item) => {
      path.push(item.split(" "));
    });
    return {
      type: "LineString",
      path: path,
    };
  }
  if (area.match("Point")) {
    const path = [];
    point.forEach((item) => {
      path.push(item.split(" "));
    });
    return {
      type: "Point",
      path: path,
    };
  }
}